package com.it.zhangjun.design.pattern.visitor;

/**
 * @className: PersonelVisitor
 * @description: 个人访问者-9折
 * @author: z00018123
 * @date: 2021/4/30
 **/
public class PersonVisitor implements Visitor {
    double totalPrice = 0;

    @Override
    public void visitApple(Apple apple) {
        totalPrice += apple.getPrice() * 0.9;
    }

    @Override
    public void visitOrange(Orange orange) {
        totalPrice += orange.getPrice() * 0.9;
    }

    @Override
    public void visitBanana(Banana banana) {
        totalPrice += banana.getPrice() * 0.9;
    }
}
